{{ extend './common/layout.html' }}

{{ block 'css' }}
<link rel="stylesheet" href="/static/home/css/article.css">
{{ /block }}

{{ block 'main' }}
<!-- 文章框架开始 -->
<div class="article">
	<div class="w1100">
		<div class="container">
			<div class="article-header">
				<h3 class="article-title">{{ article.title }}</h3>
				<div class="article-info">
					<span class="author">{{ article.author.uname }}</span>
					<span>{{ dateformat(article.publishDate, 'yyyy-mm-dd') }}</span>
				</div>
			</div>
			<div class="article-content">
				{{@ article.content }}
			</div>
			<div class="article-comment">
				<h4>评论列表</h4>
				{{ if user }}
				<form class="comment-form" action="/home/artile/{{ article._id + '' }}/comment" method="post">
					<textarea class="comment" name="content"></textarea>
					<input type="hidden" name="uid" value="{{ user._id + '' }}">
					<div class="items">
						<input type="submit" value="提交">
					</div>
				</form>
				{{ else }}
				<div>请先<a href="/login">登录</a>后，再进行评论</div>
				{{ /if }}
				<div class="comment-list">
					{{ each comments v }}
					<div class="mb10">
						<div class="article-info">
							<span class="author">{{ v.user.uname }}</span>
							<span>{{ dateformat(v.createAt, 'yyyy-mm-dd HH:MM:ss') }}</span>
							<span>{{ v.user.email }}</span>
						</div>
						<div class="comment-content">
							{{ v.content }}
						</div>
					</div>
					{{ /each }}
				</div>
			</div>
		</div>
	</div>
</div>
<!-- 文章框架结束 -->
{{ /block }}